Skip to content

Add chicken head and demo motion modes with a Motion modes panel - #58

Open
yassinsolim wants to merge 14 commits into
feature/arm-startup-and-launchersfrom
feature/motion-modes
Open

yassinsolim wants to merge 14 commits into
feature/arm-startup-and-launchersfrom
feature/motion-modes

Conversation

@yassinsolim

@yassinsolim yassinsolim commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Adds two motion modes to teleop, switched from a new Motion modes RViz panel:

  • Chicken head mode holds the tool tip at one spot while the rest of the arm moves around it; the left stick tilts the tool about the tip and the right stick rolls it.
  • Demo mode moves the arm around by itself, slowly and smoothly, and comes back to exactly the pose it started from when switched off.

Stacked on #57 (start-up guide and launchers), so the base is that branch. When #57 is merged with a merge commit and its branch deleted, GitHub retargets this PR to main and the diff stays the same. This branch already contains #57's head.

These modes have not been run on the real arm yet. They were tested on the simulated drives, in a real RViz window, and in CI. The first real run should be at the lowest speed level (D-pad down twice) with the emergency stop within reach. Demo mode goes through the same path as the sticks (acceleration limit, joint limits, collision check) and needs Start, so it gets the same limits and checks as driving by hand, but nobody has watched it on the hardware.

What it adds

Chicken head mode

  • Switching it on moves the tool tip in a straight line in joint space, at the selected speed level, to a head spot set in xbox_teleop.yaml (30 cm forward, 55 cm up, tool level), then holds the tip there. The sticks are ignored during the approach, and a stick still held on arrival has to be centred first.
  • Stop, home and a group change end the mode. It needs all five arm joints, and a tilt that reaches the end of its range names the joint that stopped it.
  • Switching it off while a stick is held waits for centred sticks. Without that, the active group's mapping took the stick at once and the shoulder swung 29 degrees in a second in the test.
  • arm/chicken_head/set_enabled (std_srvs/SetBool) switches it and arm/chicken_head (latched) reports it.

Demo mode

  • Each joint swings sinusoidally about the pose the arm is in when the mode starts, at its own rate, so the motion does not repeat within a 120 s loop. The swing grows from nothing over a 12 s minimum-jerk ramp and shrinks back over one when switched off. The ramp can be reversed at any moment without a jump in speed or acceleration.
  • Safety: it needs Start; B, Start, Y, A or a lost controller end it at once and hold the arm. The arm stays 10 degrees clear of its joint limits, a joint with less than 3 degrees of room stays still, and if a link would reach the table or the base at the extremes the whole swing is made smaller (or the mode refuses to start and says what is in the way). A step refused by the collision check ends the mode, rumbles the controller and says why.
  • With the default settings no joint goes faster than about 6.3 deg/s, and settings that would exceed max_speed_deg_s (12) are refused when teleop starts. The speed level can slow the demo but never speeds it up.
  • arm/demo/set_enabled switches it, and arm/demo reports off, running, stopping or unavailable, republished every 0.5 s.

The Motion modes panel

  • One row per mode, built from the ModeSpec table in mode_model.cpp: the topic and service the teleop node uses, the words for its states and which of them count as on. A third mode is a table entry plus a ROS contract module in waybionic_teleop (test_motion_modes_panel.py checks that the two agree).
  • The layout's saved window state is rebuilt for the new panel name, from the state before chicken head, so it carries no stale dock.

The Motion modes panel while demo mode runs

Refusals say why. Only one mode runs at a time:

Chicken head refused while demo mode runs

A drive-health change that affects real drives: false STALLED reports

The stall check needs the encoder to move at least 1 degree in 2 seconds while motion is commanded, but any non-zero commanded speed counted as motion. A joint told to crawl, such as at the end of a slow swing, covers less than that even when it does exactly what it is told, so it was reported STALLED (a drive row in ERROR for a second at a time, and the setup guide flipping to "Checking the drives"). Demo mode made it visible on the simulated drives.

sim_arm_drives_node now passes motion_commanded only when the commanded output speed would cover 1.5 times the stall distance in the stall window, which is 0.75 deg/s with the current thresholds. Trade-off to review: a drive commanded slower than that is no longer checked for a stall, because the slow end of a swing cannot be told apart from a stuck joint. Stalls at normal speeds are still caught.

Also

  • The relay listening test reads the whole echoed frame; TCP may hand it back in pieces, so it failed now and then.
  • docs/operator_guide.md and the RViz plugin README describe both modes; the guide now shows the panel (screenshots in docs/images/, about 460 KB each).

How it was tested

  • Docker CI (docker compose --progress plain build test) on this branch's last code commit: 1747 tests, 0 failures. GitHub CI runs on this PR.
  • Real RViz window with real mouse clicks (macOS accessibility clicks, not ROS calls): 28 of 28 checks pass for demo mode: the refusal before Start, the switch on and off, chicken head refused while the demo runs, the return to the start pose and resuming part-way through it, B and a lost controller ending it with the arm held, the Arm setup panel staying away, and peak joint and tool-tip speeds under the limits, slower after D-pad down. The chicken head checks (20) pass too.
  • Simulated drives: in chicken head mode the tip stays within half a millimetre of the spot; in demo mode the arm follows the path to within 0.2 degrees, and it returns to its start pose.
  • Not tested: the real arm (see above); a Windows launch.

Known gaps

…und it

Switching it on moves the tool tip, in a straight line in joint space and at the selected speed, to a head spot set in xbox_teleop.yaml (30 cm forward, 55 cm up, tool level). It then holds the tip there while the left stick tilts the tool about it and the right stick rolls it, so the shoulder, elbow and wrist swing around a tip that stays put. The sticks are ignored during the approach, and a stick still held on arrival must be centred first. Stop, home and a group change end the mode, it needs every arm joint, and a tilt that reaches the end of its range names the joint that stopped it.
TCP may hand back a frame in pieces, so reading it once made the test fail now and then.
The teleop node serves arm/chicken_head/set_enabled (SetBool) and publishes the mode's state on arm/chicken_head, for the RViz panel that follows. The RViz label reads HEAD while it is on, and the teleop.group and teleop.speed rows describe it.
A checkbox in the right-hand dock, under Arm setup, switches chicken head mode. It reads
the latched /arm/chicken_head topic and calls /arm/chicken_head/set_enabled, so the box
follows what the teleop node reports rather than the click, and a refusal such as "Press
Start first" is shown instead. Like the other panels it sends no motion commands.

The Qt-free model has gtests; the panel's height logic moves to panel_fit.hpp so the setup
panel and this one share it, and this panel also refuses spare height so the dock gives it
to the panels beside it. The layout's saved window state is rebuilt for the new dock.
The hold message said "left stick" and "right stick" whatever chicken_head.axes held. It now
names the configured inputs. Two tests tie the RViz panel to the node: the topic, service and
row names, and every state the node publishes, must be the ones the panel's model reads.
Switching the mode off from RViz while a stick was still held let the active group's mapping
take that stick at once: in the test the shoulder swung 29 degrees in a second. The mode now
holds the arm until the sticks are centred, as pressing Y already does, and says so. With the
sticks centred nothing waits and the note stays.
Each joint swings sinusoidally about the pose the arm is in when the mode starts, at its own
rate, so the motion does not repeat before a 120 s loop is over. The swing grows from nothing
over a minimum-jerk ramp and shrinks back over one when the mode is switched off, which returns
the arm to exactly the pose it began from. The ramp can be reversed at any moment without a
jump in speed or acceleration, and a short trip takes proportionally less time.

It goes through the same path as the sticks (acceleration limit, joint limits, collision
check), so it can run on the real arm. It needs Start, the sticks do nothing, B, Start, Y, A
and a lost controller end it at once, and the speed level can slow it but never speed it up.
A joint that is locked or switched off stays still, one near a limit swings less, and a swing
whose extremes would reach the table or the base is made smaller or refused. If a step runs
into something anyway the mode ends and holds the arm. The settings are refused at load if a
joint could exceed max_speed_deg_s. With the defaults, joints peak at about 7 deg/s, 3 deg/s2,
and the tool tip at under 10 cm/s.
arm/demo/set_enabled (std_srvs/SetBool) switches the mode and answers with why it cannot start,
and arm/demo carries its state (off, running, stopping or unavailable) and what is going on,
republished every 0.5 s like the chicken head topic. A mode that stopped itself keeps saying why
as a warning until it is switched on again. The RViz label shows DEMO, and the diagnostics rows
show the demo's own speed limit.
A second mode would have meant a second panel that copied the first one. The panel now has a
row for each motion mode, built from a table in mode_model.cpp: the row, topic and service the
teleop node uses for it, the words for its states, and which of them count as on. Chicken head is
the only row for now, and behaves as before: the same 19 real-mouse checks in RViz pass.

A row whose report is marked as a warning is shown in the warning colour, and the waiting
message is shown once for the panel instead of in every row. The layout's saved window state is
rebuilt for the new name, from the state before chicken head so that it carries no stale dock.
A second row, built from a second table in mode_model.cpp: /arm/demo and /arm/demo/set_enabled,
with the states off, running, stopping (shown as returning, and not ticked, so ticking the box
again resumes the demo) and unavailable. The refusal shows in the panel, for example "Switch
Chicken head off first", and a demo that stopped because something was in the way keeps saying
so in the warning colour.

Checked in real RViz with real mouse clicks on the simulated station: refused before Start,
runs, chicken head refused while it runs, sticks do nothing, D-pad down halves the pace, unticking
brings every joint back to its start pose (0.000 deg off), ticking during the return resumes, B
and a lost controller end it and the box follows. Measured from the simulated drives, joints peak
at 6.3 deg/s, the tool tip at 7.8 cm/s, and the arm follows the command to 0.014 deg rms.
The drive-health stall check needs the encoder to move at least 1 degree in 2 seconds while
motion is commanded, but any nonzero commanded speed counted as motion. A joint told to crawl,
such as one at the end of a slow swing, covers less than that even when it does exactly what it
is told, so it was reported STALLED: a drive row in ERROR for a second at a time, with the setup
guide flipping to "Checking the drives". Demo mode made it show up: on the simulated drives the
base, shoulder and wrists were flagged at the start and the end of every swing.

The drive node now passes motion as commanded only when the commanded output speed would cover
1.5 times the stall distance in the stall window. A drive that does not move at a walking pace
is still called stalled, as before, and a large error is still caught as a following error. With
this, 135 s of demo mode on the simulated drives produced no health change at all.
Wander.rollback was meant for pausing the demo when a step is refused, but the mode ends and
holds the arm instead, so nothing used it. A demo that stopped now says "blocked by" followed
by what stopped it, which reads right for a link in the way as well as a joint limit.
That branch only gained a merge of main, which changes no file, so the
merge keeps this branch's files as they are.
Screenshots from a real RViz window with the simulated drives: demo mode running, chicken head refused while it runs, and demo mode refused before Start. They show what the panel says in each case, so an operator can match it against what they see.
Copilot AI balanced review requested due to automatic review settings November 14, 2026 10:50
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f3e440d-ccf4-4e63-9026-432a47480fa8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Pressing A can leave either mode active and moving when started from the incision group with the tool withdrawn, while premature relay disconnects can hang the echo test indefinitely.

2 open issues
What changed in this PR

Adds chicken head tip-holding and autonomous demo motion to the existing teleop system, with a shared RViz panel for control and status.

Changes:

  • Adds configurable motion modes, ROS services and status topics, safety checks, and controller handover behavior.
  • Integrates the Motion modes panel into the ground station layout.
  • Expands tests and operator guidance, adjusts slow-motion stall detection, and handles fragmented relay echoes in testing.
File Description
waybionic_teleop/​waybionic_teleop/​xbox_teleop_node.py Exposes mode services, status topics, and diagnostics.
waybionic_teleop/​waybionic_teleop/​wander.py Generates demo swings and reversible ramps.
waybionic_teleop/​waybionic_teleop/​teleop.py Implements mode configuration, motion, and transitions.
waybionic_teleop/​waybionic_teleop/​sim_arm_drives_node.py Qualifies stall detection by commanded speed.
waybionic_teleop/​waybionic_teleop/​demo_mode.py Defines the demo status contract.
waybionic_teleop/​waybionic_teleop/​chicken_head.py Defines the chicken head status contract.
waybionic_teleop/​test/​test_xbox_teleop_node.py Tests mode services, reporting, and controller-loss handling.
waybionic_teleop/​test/​test_wander.py Tests ramps, swing bounds, and tempo changes.
waybionic_teleop/​test/​test_sim_arm_drives_node.py Tests stall detection during slow motion.
waybionic_teleop/​test/​test_motion_modes_panel.py Checks Python and C++ mode contracts agree.
waybionic_teleop/​test/​test_demo_mode.py Tests demo motion, limits, and transitions.
waybionic_teleop/​test/​test_chicken_head.py Tests approach, tip holding, and handover.
waybionic_teleop/​test/​test_carrier_relay.py Collects fragmented TCP echo responses.
waybionic_teleop/​test/​conftest.py Makes the parameter fixture session-scoped.
waybionic_teleop/​config/​xbox_teleop.yaml Adds default settings for both modes.
waybionic_rviz_plugins/​test/​test_mode_model.cpp Tests status parsing and mode definitions.
waybionic_rviz_plugins/​src/​setup_panel.cpp Reuses the shared panel-height helper.
waybionic_rviz_plugins/​src/​motion_modes_panel.cpp Implements mode switches and status display.
waybionic_rviz_plugins/​src/​mode_model.cpp Defines mode tables and status parsing.
waybionic_rviz_plugins/​src/​ground_station_rviz.cpp Places Motion modes in the right dock.
waybionic_rviz_plugins/​README.md Documents the panel and mode contracts.
waybionic_rviz_plugins/​plugin_description.xml Registers the Motion modes plugin.
waybionic_rviz_plugins/​include/​waybionic_rviz_plugins/​panel_fit.hpp Shares width-aware panel-height sizing.
waybionic_rviz_plugins/​include/​waybionic_rviz_plugins/​motion_modes_panel.hpp Declares panel state and ROS interfaces.
waybionic_rviz_plugins/​include/​waybionic_rviz_plugins/​mode_model.hpp Declares mode definitions and parsing interfaces.
waybionic_rviz_plugins/​CMakeLists.txt Builds the panel, model, and model tests.
waybionic_bringup/​rviz/​waybionic_unified.rviz Adds the panel and updates saved geometry.
docs/​operator_guide.md Explains mode operation, controls, and safety precautions.

Review effort: Balanced

Comment on lines 551 to +553
if homing and not incision:
self.end_head()
self.end_demo()
client.sendall(frame)
echoed = b''
while len(echoed) < len(frame):
echoed += client.recv(64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants